using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using NUnit.Framework;
using LeadTracker.Models;

namespace LeadTracker.Models.NUnitClassic
{
	
    public partial class LeadCommentModelTests
    {


        
        [Test]
        public void LeadCommentModelTests_Property_LeadKey_NotifyPropertyChanged ()
        {
            var objectUnderTest = CreateObject();
            var events = new List<PropertyChangedEventArgs>();
            ((INotifyPropertyChanged)objectUnderTest).PropertyChanged += (s, e) => events.Add(e);


			//Setting the value to the current value should always work and not raise any events
			var originalValue = objectUnderTest.LeadKey;
			objectUnderTest.LeadKey = originalValue;
			Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

        
            
            events.Clear();
            try
            {
                System.Int32 expectedValue = Int32.MinValue;
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.LeadKey);
                objectUnderTest.LeadKey = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "LeadKey"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.Int32 expectedValue = (System.Int32)(-1);
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.LeadKey);
                objectUnderTest.LeadKey = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "LeadKey"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.Int32 expectedValue = (System.Int32)0;
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.LeadKey);
                objectUnderTest.LeadKey = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "LeadKey"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.Int32 expectedValue = (System.Int32)1;
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.LeadKey);
                objectUnderTest.LeadKey = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "LeadKey"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.Int32 expectedValue = Int32.MaxValue;
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.LeadKey);
                objectUnderTest.LeadKey = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "LeadKey"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
        
        }    
        
        
        [Test]
        public void LeadCommentModelTests_Property_Comment_NotifyPropertyChanged ()
        {
            var objectUnderTest = CreateObject();
            var events = new List<PropertyChangedEventArgs>();
            ((INotifyPropertyChanged)objectUnderTest).PropertyChanged += (s, e) => events.Add(e);


			//Setting the value to the current value should always work and not raise any events
			var originalValue = objectUnderTest.Comment;
			objectUnderTest.Comment = originalValue;
			Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

        
            
            events.Clear();
            try
            {
                System.String expectedValue = null;
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.Comment);
                objectUnderTest.Comment = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "Comment"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.String expectedValue = "";
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.Comment);
                objectUnderTest.Comment = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "Comment"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.String expectedValue = "1";
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.Comment);
                objectUnderTest.Comment = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "Comment"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.String expectedValue = "x";
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.Comment);
                objectUnderTest.Comment = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "Comment"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.String expectedValue = ",";
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.Comment);
                objectUnderTest.Comment = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "Comment"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.String expectedValue = "123";
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.Comment);
                objectUnderTest.Comment = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "Comment"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.String expectedValue = "abc";
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.Comment);
                objectUnderTest.Comment = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "Comment"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.String expectedValue = "1,2,3";
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.Comment);
                objectUnderTest.Comment = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "Comment"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.String expectedValue = "a,b,c";
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.Comment);
                objectUnderTest.Comment = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "Comment"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.String expectedValue = "1;2;3";
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.Comment);
                objectUnderTest.Comment = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "Comment"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.String expectedValue = "a;b;c";
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.Comment);
                objectUnderTest.Comment = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "Comment"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.String expectedValue = "http://test.com";
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.Comment);
                objectUnderTest.Comment = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "Comment"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
            
            events.Clear();
            try
            {
                System.String expectedValue = "test@test.com";
                var valueChanged = !Object.Equals(expectedValue, objectUnderTest.Comment);
                objectUnderTest.Comment = expectedValue;
                
            	if (valueChanged)
					Assert.IsTrue(events.Any(e => e.PropertyName == "Comment"));
				else
					Assert.IsTrue(events.Count() == 0, "No change events should have been raised, the property's value didn't change.");

            }
            catch (ArgumentException)
            {
                //OK
                return;
            }
            
        
        }    
        
    }
}

